package graphic.primitives.general;

import graphic.window.MainWindow;

/**
 * Abstract class which implements things, that are everywhere still the same:
 * getting instance of MainWindow for drawing and saving or returning coordinates.
 * 
 * This class is abstract, because it will not be used alone, only when derivating
 * new classes.
 * 
 * @author Tomas Zima
 */
abstract public class GraphicObject implements IGraphicObject
{
	/**
	 * Constructor.
	 * 
	 * @param void
	 * @return void
	 */
	public GraphicObject()
	{
		this.mainWindow = MainWindow.getInstance();
	}
	
	/**
	 * Constructor.
	 * Sets position of the object immediately.
	 * 
	 * @param int [x]
	 * @param int [y]
	 */
	public GraphicObject(int x, int y)
	{
		this();
		this.setXY(x, y);
	}
	
	/**
	 * Set coordinates of the object.
	 * 
	 * @param int [x]
	 *		Coordinate in the X axis.
	 * 
	 * @param int [y]
	 *		Coordinate int the Y axis.
	 * 
	 * @return void
	 */
	@Override
	public void setXY(int x, int y)
	{
		this.x = x;
		this.y = y;
	}
	
	/**
	 * Return coordinate in the X axis.
	 * 
	 * @param void
	 * @return int
	 */
	@Override
	public int getX()
	{
		return x;
	}
	
	/**
	 * Returns coordinate in the Y axis.
	 * 
	 * @param void
	 * @return int
	 */
	@Override
	public int getY()
	{
		return y;
	}
	
	protected MainWindow	mainWindow;
	protected int			x;
	protected int			y;
}
